﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        String username = txtUsername.Text;
        String password = txtPassword.Text;

        if (username != "" && password != "")
        {
            ChoDienTuDataContext cdt = new ChoDienTuDataContext();

            int t = cdt.Login_Admin(username, password).Count();
            if (t > 0)
            {

                Session["admin"] = username;
                Response.Redirect("Default.aspx");
            }
            else
            {
                Label3.Text = "Đăng nhập thất bại";
            }
        }
        else
        {
            Label3.Text = "Nhập username & password";
        }
    }
}